﻿using UnityEngine;
using System.Collections;
using System;
namespace net{
	public class NetPlayerCreated : MonoBehaviour {

		void OnNetworkInstantiate(NetworkMessageInfo info){
			if(networkView.isMine){
			EasyButton	shotBtn = GameObject.FindObjectOfType<EasyButton>();
				//绑定坦克
				shotBtn.receiverGameObject = transform.root.gameObject;
				if(Network.isClient){
					GetComponent<NetCtrl>().setReverseFactor(-1);
				}
			}
			else{
				try{
				GetComponent<NetCtrl>().enabled = false;
				
				GetComponent<CameraFollow>().enabled = false;
				GetComponent<NetFire>().enabled = false;
				GetComponent<NetAI>().enabled = false;

				//this.enabled = false;
				}
				catch(NullReferenceException ex){

				}
			}
		}

	}

}